09. Decision Tree Accuracy

[object Object]

Question:

Start Quiz:

import sys
from class_vis import prettyPicture
from prep_terrain_data import makeTerrainData

import numpy as np
import pylab as pl

features_train, labels_train, features_test, labels_test = makeTerrainData()



#################################################################################


########################## DECISION TREE #################################



#### your code goes here



acc = ### you fill this in!
### be sure to compute the accuracy on the test set


    
def submitAccuracies():
  return {"acc":round(acc,3)}

Solution:

INSTRUCTOR NOTE:

NOTE: You might get an accuracy of 91.2% instead of 90.8%, not to worry. If you run the quiz a few times you'll see that either result is possible, apparently a minor instability in the DecisionTreeClassifier().

To observe a stable and reproducible accuracy leverage the random_state parameter, as in DecisionTreeClassifier(random_state= 42) Where the value of random state can take on any integer.